<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SimplePosts.ascx.cs" Inherits="FreeLancer.HRB.WebApp.UserControls.SimplePosts" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
  Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
  
<div>
  <div style="margin-bottom: 10px;">
    <span><%=Resources.labels.language %></span>
    <asp:DropDownList runat="server" ID="cboLanguage" Width="100px" 
      OnSelectedIndexChanged="cboLanguage_SelectedIndexChanged" AutoPostBack="true">
    </asp:DropDownList>
  </div>
  <div class="settings">
    <dxwgv:ASPxGridView ID="ASPxGridViewPosts" runat="server"
      AutoGenerateColumns="False" KeyFieldName="PostId"
      SettingsEditing-Mode="Inline" 
      SettingsPager-Visible="true" 
      SettingsBehavior-ConfirmDelete="true"
      SettingsText-CommandCancel="<%$ Resources:labels, cmdCancel %>"
      SettingsText-ConfirmDelete="<%$ Resources:labels, cmdConfirmDelete %>"
      SettingsText-CommandUpdate="<%$ Resources:labels, cmdUpdate %>"
      Width="1000px"
      PreviewFieldName="PostContent"
      OnHtmlRowPrepared="ASPxGridViewPosts_OnHtmlRowPrepared"
      OnRowDeleting="ASPxGridViewPosts_OnDeleting"
      OnRowUpdating="ASPxGridViewPosts_OnUpdating"
      >
      <Settings ShowFilterRow="True"/>
      <Columns>
        <dxwgv:GridViewCommandColumn VisibleIndex="0" Width="100px">
          <EditButton Visible="True" Text="<%$ Resources:labels, cmdUpdate %>">
          </EditButton>
          <DeleteButton Visible="True" Text="<%$ Resources:labels, cmdDelete %>">
          </DeleteButton>
          <ClearFilterButton Visible="True" Text="<%$ Resources:labels, cmdClearFilter %>">
          </ClearFilterButton>
          <CancelButton Text="<%$ Resources:labels, cmdCancel %>">
          </CancelButton>
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewCommandColumn>
        <dxwgv:GridViewDataTextColumn Caption="ID" FieldName="PostId" Visible="false">
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, title %>" 
          FieldName="Title" VisibleIndex="1" ReadOnly="true">
          <HeaderStyle HorizontalAlign="Center" />
          <EditFormSettings Visible="False"/>
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataDateColumn Caption="<%$ Resources:labels, dateCreated %>" 
          FieldName="DateCreated" VisibleIndex="2" Width="150px" ReadOnly="true">
          <HeaderStyle HorizontalAlign="Center" />
          <PropertiesDateEdit DisplayFormatString="G">
          </PropertiesDateEdit>
          <EditFormSettings Visible="False"/>
        </dxwgv:GridViewDataDateColumn>
        <dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, author %>" 
          FieldName="Author" VisibleIndex="3" Width="100px" ReadOnly="true">
          <HeaderStyle HorizontalAlign="Center" />
          <EditFormSettings Visible="False"/>
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataCheckColumn Caption="<%$ Resources:labels, approved %>" 
          FieldName="IsPublished" VisibleIndex="4" Width="100px">
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataCheckColumn>
        <dxwgv:GridViewDataDateColumn 
          FieldName="PostContent" VisibleIndex="5" Visible="false">
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataDateColumn>
        <%--<dxwgv:GridViewDataDateColumn 
          FieldName="Comment" VisibleIndex="6" Visible="false">
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataDateColumn>--%>
      </Columns>
      <Templates>
        <DetailRow>
          <dxwgv:ASPxGridView ID="ASPxGridViewComments" runat="server"
            AutoGenerateColumns="False" KeyFieldName="PostCommentId"
            SettingsEditing-Mode="EditFormAndDisplayRow" 
            SettingsPager-Visible="true" 
            SettingsBehavior-ConfirmDelete="true"
            Settings-ShowTitlePanel="true"
            SettingsText-CommandCancel="<%$ Resources:labels, cmdCancel %>"
            SettingsText-ConfirmDelete="<%$ Resources:labels, cmdConfirmDelete %>"
            SettingsText-CommandUpdate="<%$ Resources:labels, cmdUpdate %>"
            SettingsText-Title="<%$ Resources:labels, comment %>"
            Width="100%"
            PreviewFieldName="Comment"
            OnBeforePerformDataSelect="ASPxGridViewComments_OnBeforePerformDataSelect"
            OnHtmlRowPrepared="ASPxGridViewComments_OnHtmlRowPrepared"
            OnRowDeleting="ASPxGridViewComments_OnDeleting"
            OnRowUpdating="ASPxGridViewComments_OnUpdating"
            OnRowInserting="ASPxGridViewComments_OnInserting">
            <Columns>
              <dxwgv:GridViewCommandColumn VisibleIndex="0" Width="150px">
                <NewButton Visible="True" Text="<%$ Resources:labels, cmdAnswer %>">
                </NewButton>
                <EditButton Visible="True" Text="<%$ Resources:labels, cmdUpdate %>">
                </EditButton>
                <DeleteButton Visible="True" Text="<%$ Resources:labels, cmdDelete %>">
                </DeleteButton>
                <ClearFilterButton Visible="True" Text="<%$ Resources:labels, cmdClearFilter %>">
                </ClearFilterButton>
                <CancelButton Text="<%$ Resources:labels, cmdCancel %>">
                </CancelButton>
                <HeaderStyle HorizontalAlign="Center" />
              </dxwgv:GridViewCommandColumn>
              <dxwgv:GridViewDataTextColumn Caption="ID" FieldName="PostCommentId" Visible="false">
              </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataDateColumn Caption="<%$ Resources:labels, dateModified %>" 
                FieldName="CommentDate" VisibleIndex="1" Width="150px" ReadOnly="true">
                <HeaderStyle HorizontalAlign="Center" />
                <PropertiesDateEdit DisplayFormatString="G">
                </PropertiesDateEdit>
              </dxwgv:GridViewDataDateColumn>
              <dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, author %>" 
                FieldName="Author" VisibleIndex="2" Width="100px" ReadOnly="true">
                <HeaderStyle HorizontalAlign="Center" />
              </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataCheckColumn FieldName="IsApproved" Caption="<%$ Resources:labels, approved %>" 
                VisibleIndex="4" Width="100px">
                <HeaderStyle HorizontalAlign="Center" />
              </dxwgv:GridViewDataCheckColumn>
              <dxwgv:GridViewDataTextColumn Caption="">
              </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="Comment" Visible="false">
              </dxwgv:GridViewDataTextColumn>
            </Columns>
            <Templates>
              <EditForm>
                <div style="padding-left: 20px;">
                  <div>
                    <dxe:ASPxCheckBox ID="ASPxCheckBoxApproved" runat="server" 
                      Value='<%# Eval("IsApproved")%>' ValueType="System.Boolean"
                      Text="<%$ Resources:labels, approved %>">
                    </dxe:ASPxCheckBox>
                  </div>
                  <div style="padding: 4px; font-weight:bold;">
                    <span><%=Resources.labels.content %></span>
                  </div>
                  <dxe:ASPxMemo ID="ASPxMemoComment" runat="server" Height="150px" Text='<%# Eval("Comment")%>'
                    Width="100%">
                  </dxe:ASPxMemo>
                </div>
                <div style="text-align:right; padding:2px 2px 2px 2px">
                  <dxwgv:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server"></dxwgv:ASPxGridViewTemplateReplacement>
                  <dxwgv:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server"></dxwgv:ASPxGridViewTemplateReplacement>
                </div>
              </EditForm>
              <PreviewRow>
                <div style="padding-left:10px; padding-right: 10px;">
                  <%# Container.Text %>
                </div>
              </PreviewRow>
            </Templates>
            <Settings ShowPreview="true"/>
              <SettingsPager Summary-Visible="true" AlwaysShowPager="true" Mode="ShowPager" PageSize="5">
                <Summary AllPagesText="<%$ Resources:labels, postsAllPagesText %>" Text="<%$ Resources:labels, postsPageText %>" />
              </SettingsPager>
          </dxwgv:ASPxGridView>
        </DetailRow>
      </Templates>
      <Settings ShowPreview="true"/>
      <SettingsDetail ShowDetailRow="true" AllowOnlyOneMasterRowExpanded="true"/>
      <SettingsPager Summary-Visible="true" AlwaysShowPager="true" Mode="ShowPager" PageSize="10">
        <Summary AllPagesText="<%$ Resources:labels, postsAllPagesText %>" Text="<%$ Resources:labels, postsPageText %>" />
      </SettingsPager>
    </dxwgv:ASPxGridView>
  </div>
</div>